<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>P59 【例3-5】demo05.html</title>
</head>

<body>
    <script>
        var arr = [89, 56, 100, 21, 87, 45, 1, 888];
        console.log('待排序数组：' + arr);
        for (var i = 1; i < arr.length; ++i) {
            for (var j = i; j > 0; --j) {
                if (arr[j - 1] > arr[j]) {
                    [arr[j - 1], arr[j]] = [arr[j], arr[j - 1]];
                }
            }
        }
        console.log('排序后的数组：' + arr);
    </script>
    <a href="../首页/page03.html">
        <h2>返回上一页面</h2>
    </a>
</body>

</html>